﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Vici.Mvc;
using System.IO;
namespace web
{
    public class ProcessCenter:Controller
    {
        public void Run()
        { 

        }

        [Url("PC/FileUpLoad")]
        public void FileUpLoad()
        {

            string filePath = "/UpLoadFile/Image";
            string newPath = string.Empty;
            string title = "SS";
            int count = Request.Files.Count;
            if (count > 0)
            {
                newPath=DateTime.Now.ToString("/yyyyMMddHH/");
                if (!Directory.Exists(Server.MapPath(filePath) + newPath))
                {
                    Directory.CreateDirectory(Server.MapPath(filePath) + newPath);
                }
                Request.Files[0].SaveAs(Server.MapPath(filePath) +newPath + Request.Files[0].FileName);
            }
            Response.Write(string.Format("{{'url':'{0}','title':'{1}','state':'{2}'}}", newPath + Request.Files[0].FileName, title, "SUCCESS"));
            Response.End();
        }

    }
}